package com.zh.oauth.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.zh.common.entity.Oauth;
import com.zh.common.entity.ElecMenu;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;

@ApiModel("机构用户实体类")
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("elec_user")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ElecUser extends Oauth {
    private static final long serialVersionUID = 4888275558763074900L;

    @ApiModelProperty(value = "主键", name = "id")
    private Long id;
    @ApiModelProperty(value = "固定电话", name = "userPhone")
    private String userPhone;
    @ApiModelProperty(value = "手机号码", name = "userMobile")
    private String userMobile;
    @ApiModelProperty(value = "电子邮箱", name = "userEmail")
    private String userEmail;
    @ApiModelProperty(value = "地址", name = "userAddress")
    private String userAddress;
    @ApiModelProperty(value = "用户状态 1-正常 2-冻结 3-锁定", name = "userStatus", required = true)
    private Integer userStatus;
    @ApiModelProperty(value = "上次登陆时间", name = "userLastLogin")
    private Date userLastLogin;
    @ApiModelProperty(value = "登陆错误日期", name = "userLoginErrorDate")
    private Date userLoginErrorDate;
    @ApiModelProperty(value = "当天登陆错误次数", name = "userErrorCount")
    private Integer userErrorCount;
    @ApiModelProperty(value = "注册的IP", name = "userRegIp")
    private String userRegIp;
    @ApiModelProperty(value = "注册的时间", name = "userRegTime")
    private Date userRegTime;
    @ApiModelProperty(value = "注册的备注", name = "userRegRemark")
    private String userRegRemark;
    @ApiModelProperty(value = "头像地址", name = "userAvatar")
    private String userAvatar;
    @ApiModelProperty(value = "返回所属信息", name = "map")
    private Map<String, Object> map;
    @ApiModelProperty(value = "验证码", name = "captcha")
    @TableField(exist = false)
    private String captcha;


    public ElecUser() { }

    public ElecUser(boolean isAccountNonLocked, boolean isAccountNonExpired, boolean isCredentialsNonExpired, boolean isEnabled, boolean isWait) {
        super(isAccountNonLocked, isAccountNonExpired, isCredentialsNonExpired, isEnabled, isWait);
    }

    public ElecUser(Long id, String userRoleId, Integer typeId,
                    Long foreignKeyId, String foreignNo, String foreignName,
                    String userLoginName, String userPassword,
                    Collection<? extends GrantedAuthority> authorities, boolean isAccountNonLocked,
                    boolean isAccountNonExpired, boolean isCredentialsNonExpired, boolean isEnabled, boolean isWait) {
        super(userRoleId, typeId, foreignKeyId, foreignNo, foreignName, userLoginName, userPassword, authorities,
                isAccountNonLocked, isAccountNonExpired, isCredentialsNonExpired, isEnabled, isWait);
        this.id = id;
    }
}
